from django.contrib import admin

from .models import *


@admin.register(Student)
class StudentAdmin(admin.ModelAdmin):
    list_display = ['name', 'student_number', 'phone', 'room_id', 'build_id', 'sex']
    list_display_links = ['name']
    # autocomplete_fields = ['room_id']
    # raw_id_fields = ['room_id']  # 外健可选择
    search_fields = ('name',)  # 可搜索字段，只能设置一个
    readonly_fields = ['build_id', 'room_id']


@admin.register(Houseparent)
class HouseparentAmdin(admin.ModelAdmin):
    list_display = list_display_links = ['username', 'password', 'name', 'phone', 'sex', 'build_id']
